home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-02
/
wgt_tp1.zip
/
FEATURE.DOC
< prev
next >
Wrap
Text File
|
1992-07-05
|
3KB
|
70 lines
WordUp Graphics Toolkit
-----------------------
Important Features:
Two very important and useful features have been included with this
kit. They are public variables available to your program, which are used by
the WGT to process information.
Memory Issues
-------------
This first is simply a tool for those who like to keep track of their
program's memory usage. The WGT uses a lot of dynamic memory allocation, and
currently very little error checking. Some programs which work fine on the
developer's computer may not have enough memory to run on someone else's.
To use the variable, run your program through (entirely) once. Upon its
completion, go to the Debug 'Evaluate and Modify' menu selection. At the
Expression prompt, type MEMORY_USAGE. The result box should display a number.
This is the number (in bytes) of memory your program used as overhead during
its execution. You can add a line at the beginning of your program which will
check available memory and stop execution if this figure can't be met.
For example, if you run your program and MEMORY_USAGE reveals a size
of 45000, you would then start your program out like
IF MaxAvail < Memory_Usage then
BEGIN
Writeln('This program requires 45000 bytes of free memory.');
Halt(0); {This line stops execution of the program}
END
ELSE .......
Graphics Pages
--------------
Some video modes allow users to set a visual and an active page. This
means that while the user watches one screen, the computer can be drawing on
another. Many animation sequences are created by flipping from page to page.
Unfortunately, the 320*200*256 mode does not support these pages. The WGT does
however provide a 'False' version of these pages. Our active page may change,
but the visual page is always set.
We use the Init_Screen to allocate memory for a different screen of
memory to be used. The screen is referenced by a pointer. This allows us to
create and remove screens of memory, but how do we select them for use?
Two variables are utilized to make paging easy. The first is a constant which
refers to the visual screen. This is called BASESCREEN. The second is set
by the program to tell WGT which screen to draw on. This one is called
CURRENTSCREEN. We assign it values like any other variable.
Let's assume you have initialized another screen called SECOND. The
following program segment will draw a circle on that screen, copy the entire
screen to the visual screen, and then draw a box on the visual screen.
currentscreen := SECOND;
_Circle(100,100,40);
Copy_Screen(0,0,319,199,second,0,0,basescreen);
currentscreen := BASESCREEN;
_Box(10,40,150,90);
Notice that Copy_Screen ignores the currentscreen variable and requires two
pointer names directly. This means that copying is not limited to the visual
screen. Parts of a second screen could be copied to a third or fourth. The
final result must always be copied to the basescreen to be seen.